package com.weex.app.util;

import android.content.Context;


/**
 * Created by budao on 2016/10/12.
 */
public class AppConfig {
    private static final String TAG = "AppConfig";
    private static AppPreferences sPreferences = new AppPreferences();

    public static void init(Context context) {
        loadAppSetting(context);
    }

    /**
     * @return
     */
    public static String getLaunchUrl() {
//    return  "http://192.168.3.117:9999/js/index.bundle.js";
        return "file://assets/dist/index.bundle.min.js";
//    if (isLaunchLocally()) {
//      return sPreferences.getString("local_url", "file://assets/index.js");
//    }
//    return sPreferences.getString("launch_url", "http://127.0.0.1:8080/dist/index.js");
    }

    public static Boolean isLaunchLocally() {
        return sPreferences.getBoolean("launch_locally", false);
    }

    private static void loadAppSetting(Context context) {
        AppConfigXmlParser parser = new AppConfigXmlParser();
        parser.parse(context);
        sPreferences = parser.getPreferences();
    }
}
